/**
 * file-list.css - 文件导览页面私有样式
 * 功能：文件浏览器、面包屑导航、搜索、Toast提示、文件上传、JSON查看器
 */

/* ==================== 面包屑导航和搜索栏样式 ==================== */

/* 面包屑和搜索栏的容器 - 左右分栏 */
.breadcrumb-search-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
}

.breadcrumb-container {
    flex: 0 0 70%;
    min-width: 0;
}

.search-container {
    flex: 0 0 calc(30% - 16px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-container input {
    margin: 0;
    flex: 1;
    height: 100%;
}

.search-container button {
    margin: 0;
    width: auto;
    padding: 10px 16px;
    height: 100%;
    flex-shrink: 0;
}

/* 面包屑导航 */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    font-size: 15px;
    height: 100%;
    min-height: 46px;
}

.breadcrumb-item {
    color: #3498db;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    user-select: none;
    cursor: pointer;
}

.breadcrumb-item:hover {
    background-color: #e3f2fd;
    color: #2980b9;
}

.breadcrumb-item.active {
    color: #2c3e50;
    font-weight: 600;
    background-color: #e8f4f8;
}

.breadcrumb-separator {
    color: #95a5a6;
    margin: 0 4px;
    user-select: none;
}

/* ==================== 文件浏览器容器样式 ==================== */

/* 文件浏览页面专用容器 */
.file-browser-section {
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.file-list-container {
    margin-top: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 表格包装器 - 固定高度和滚动 */
.table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

.table-wrapper table {
    margin: 0;
    border: none;
}

/* 固定表头 */
.table-wrapper thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-wrapper thead th {
    border-top: none;
}

/* 文件夹行悬停效果增强 */
tr.folder-row {
    transition: background-color 0.2s;
}

tr.folder-row:hover {
    background-color: #f0f8ff !important;
}

/* ==================== 文件上传功能样式 ==================== */

/* 上传按钮 */
#uploadBtn {
    background-color: #27ae60;
    color: white;
    font-size: 1.2em;
    min-width: 48px;
}

#uploadBtn:hover {
    background-color: #229954;
}

/* 上传表单样式 */
.upload-form {
    margin: 16px 0;
}

.upload-form label {
    display: block;
    margin: 16px 0 8px 0;
    font-weight: 600;
    font-size: 15px;
    color: #2c3e50;
}

.upload-form input[type="text"],
.upload-form input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    margin: 0;
}

.upload-form input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 文件输入框样式优化 */
.upload-form input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.upload-form input[type="file"]::file-selector-button {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 12px;
    transition: background-color 0.2s;
}

.upload-form input[type="file"]::file-selector-button:hover {
    background-color: #2980b9;
}

/* 输入提示文字 */
.input-hint {
    font-size: 13px;
    color: #7f8c8d;
    margin: 6px 0 0 0;
    line-height: 1.4;
}

/* ==================== JSON文件查看器样式 ==================== */

/* JSON文件行悬停效果 */
tr.json-file-row {
    transition: background-color 0.2s;
}

tr.json-file-row:hover {
    background-color: #f0fff0 !important;
}

/* JSON查看器模态框 */
.modal-json-viewer {
    max-width: 80%;
    width: 92%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* JSON工具栏 */
.json-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 12px;
    flex-shrink: 0;
    gap: 16px;
}

/* 工具栏左侧 */
.json-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 1 auto;
}

/* 工具栏右侧 */
.json-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    justify-content: flex-end;
}

/* 搜索框容器 */
.json-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 4px 8px;
    transition: border-color 0.2s;
}

.json-search-box:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 搜索输入框 */
#jsonSearchInput {
    border: none;
    outline: none;
    padding: 6px 8px;
    font-size: 14px;
    width: 180px;
    background: transparent;
    margin: 0;
}

/* 搜索按钮 */
.btn-search {
    padding: 6px 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 36px;
    margin: 0;
}

.btn-search:hover {
    background: #5568d3;
    transform: scale(1.05);
}

/* 搜索导航容器 */
.json-search-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 4px 8px;
}

/* 搜索计数显示 */
.search-count {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* 导航按钮 */
.btn-nav {
    padding: 4px 8px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s;
    width: auto;
    min-width: 32px;
    margin: 0;
}

.btn-nav:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.btn-nav:active {
    transform: scale(0.95);
}

/* 清除按钮 */
.btn-clear {
    padding: 4px 8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    width: auto;
    min-width: 32px;
    margin: 0;
}

.btn-clear:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.btn-clear:active {
    transform: scale(0.95);
}

/* 格式化按钮 */
.btn-format {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    width: auto;
    margin: 0;
}

.btn-format:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-format:active:not(:disabled) {
    transform: translateY(0);
}

.btn-format:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-format span {
    display: inline-block;
}

#formatBtnIcon {
    font-size: 16px;
}

/* JSON信息显示 */
.json-info {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* JSON内容容器 */
.json-content-container {
    flex: 1;
    margin: 0;
    overflow: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #282c34;
    max-height: calc(90vh - 280px);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* JSON内容显示区域 - 基础样式 */
.json-content {
    margin: 0;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', 'Source Code Pro', monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #abb2bf;
    background-color: #282c34;
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    tab-size: 2;
    min-height: 100%;
}

/* JSON错误样式 */
.json-content.json-error {
    color: #e74c3c;
    background-color: #fff5f5;
}

/* JSON语法高亮样式 */
.json-content.json-highlighted {
    color: #abb2bf;
}

/* 键名 */
.json-content .json-key {
    color: #e06c75;
    font-weight: 600;
}

/* 字符串值 */
.json-content .json-string {
    color: #98c379;
}

/* 数字 */
.json-content .json-number {
    color: #d19a66;
    font-weight: 500;
}

/* 布尔值 */
.json-content .json-boolean {
    color: #61afef;
    font-weight: 600;
}

/* null值 */
.json-content .json-null {
    color: #c678dd;
    font-weight: 600;
    font-style: italic;
}

/* 滚动条美化 */
.json-content-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.json-content-container::-webkit-scrollbar-track {
    background: #21252b;
    border-radius: 5px;
}

.json-content-container::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 5px;
}

.json-content-container::-webkit-scrollbar-thumb:hover {
    background: #5c6370;
}

/* JSON内容代码块选中效果 */
.json-content::selection {
    background-color: #3e4451;
    color: #abb2bf;
}

/* 搜索匹配项高亮 */
.json-content mark.search-match {
    background-color: #f39c12;
    color: #2c3e50;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

/* 当前搜索匹配项高亮 */
.json-content mark.search-match-current {
    background-color: #e74c3c;
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 700;
    animation: pulse 0.5s ease-in-out;
}

/* 当前匹配项脉冲动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ==================== Toast提示样式 ==================== */

/* Toast容器 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

/* Toast项 */
.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #3498db;
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
    max-width: 400px;
}

/* Toast滑入动画 */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Toast滑出动画 */
@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.toast-removing {
    animation: slideOut 0.3s ease-in forwards;
}

/* Toast内容区 */
.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Toast图标 */
.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

/* Toast消息 */
.toast-message {
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.4;
    word-break: break-word;
}

/* Toast关闭按钮 */
.toast-close {
    background: none;
    border: none;
    color: #95a5a6;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
    margin: 0;
    margin-left: 12px;
}

.toast-close:hover {
    background: #ecf0f1;
    color: #7f8c8d;
}

/* Toast类型样式 */
.toast.toast-success {
    border-left-color: #27ae60;
}

.toast.toast-success .toast-icon {
    color: #27ae60;
}

.toast.toast-error {
    border-left-color: #e74c3c;
}

.toast.toast-error .toast-icon {
    color: #e74c3c;
}

.toast.toast-warning {
    border-left-color: #f39c12;
}

.toast.toast-warning .toast-icon {
    color: #f39c12;
}

.toast.toast-info {
    border-left-color: #3498db;
}

.toast.toast-info .toast-icon {
    color: #3498db;
}

/* ==================== 响应式设计 ==================== */

/* 响应式面包屑和搜索框 */
@media (max-width: 768px) {
    .breadcrumb-search-row {
        flex-direction: column;
        gap: 12px;
    }

    .breadcrumb-container,
    .search-container {
        flex: 1 1 100%;
    }

    .file-browser-section {
        height: calc(100vh - 220px);
    }

    .modal-json-viewer {
        max-height: 85vh;
        width: 95%;
    }

    .json-content-container {
        max-height: calc(85vh - 320px);
    }

    .json-content {
        font-size: 13px;
        padding: 16px;
        line-height: 1.7;
    }

    .json-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .json-toolbar-left,
    .json-toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .json-toolbar-right {
        flex-direction: column;
        gap: 10px;
    }

    .json-search-box {
        width: 100%;
    }

    #jsonSearchInput {
        flex: 1;
        width: 100%;
    }

    .json-search-nav {
        width: 100%;
        justify-content: space-between;
    }

    .btn-format {
        width: 100%;
        justify-content: center;
    }

    .json-info {
        text-align: center;
    }
}

@media (max-width: 600px) {
    .breadcrumb {
        font-size: 14px;
        padding: 10px 12px;
        min-height: 42px;
    }

    .breadcrumb-item {
        padding: 3px 6px;
    }

    .breadcrumb-separator {
        margin: 0 2px;
    }

    .file-browser-section {
        height: calc(100vh - 200px);
    }

    .upload-form input[type="file"]::file-selector-button {
        padding: 6px 12px;
        font-size: 14px;
    }

    .json-content {
        font-size: 12px;
        padding: 12px;
        line-height: 1.6;
    }

    .modal-json-viewer {
        width: 98%;
    }

    .json-toolbar {
        padding: 10px 12px;
    }

    .btn-format {
        padding: 8px 12px;
        font-size: 13px;
    }

    .json-info {
        font-size: 12px;
    }

    #jsonSearchInput {
        font-size: 13px;
        padding: 5px 6px;
    }

    .btn-search,
    .btn-nav,
    .btn-clear {
        font-size: 14px;
        padding: 5px 8px;
        min-width: 30px;
    }

    .search-count {
        font-size: 12px;
        min-width: 45px;
    }

    .modal-footer button {
        font-size: 13px;
        padding: 8px 16px;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
        padding: 12px 16px;
    }

    .toast-message {
        font-size: 14px;
    }

    .toast-icon {
        font-size: 20px;
    }
}
